package com.nl.controller.web.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.nl.controller.web.bean.CheckResultSynReq;
import com.nl.controller.web.service.SmsInterfaceJzzwService;

import lombok.extern.slf4j.Slf4j;

@RestController
@RequestMapping("/smsInterfaceJzzw")
@Slf4j
public class SmsInterfaceJzzwController {
	@Autowired
	private SmsInterfaceJzzwService smsInterfaceService;

	/**
	 * desc:短信通道号同步接口
	 * 
	 * @author syl
	 * @Date 2019年9月24日 下午1:59:06
	 * @param sendNumberSynReq
	 * @return
	 */
	@RequestMapping(value = "/sendNumberSyn")
	public Map<String, Object> sendNumberSyn(
			@RequestParam(value = "sendNumberSynReq", required = true) String sendNumberSynReq
	/* ,HttpServletRequest request */) {
		Map<String, Object> map = smsInterfaceService.sendNumberSyn(sendNumberSynReq);
		log.info("【短信通道号同步接口】返回数据：{}", map);
		return map;
		/*
		 * InputStream in; String reqJson=""; try { in =
		 * request.getInputStream(); reqJson = IOUtils.toString(in, "utf-8");
		 * log.info("sendNumberSynReq:"+reqJson); } catch (IOException e) {
		 * e.printStackTrace(); log.error(e.toString()); } Map<String, Object>
		 * map = smsInterfaceService.sendNumberSyn(reqJson);
		 * log.info("【短信通道号同步接口】返回数据：{}", map); return map;
		 */
	}

	/**
	 * desc:短信任务同步接口
	 * 
	 * @author syl
	 * @Date 2019年9月25日 下午5:16:47
	 * @param taskSynReq
	 * @return
	 */
	@RequestMapping(value = "/taskSyn")
	public Map<String, Object> taskSyn(@RequestParam(value = "taskSynReq", required = true) String taskSynReq
	/* HttpServletRequest request */) {
		Map<String, Object> map = smsInterfaceService.taskSyn(taskSynReq);
		log.info("【短信任务同步接口】返回数据：{}", map);
		return map;
		/*
		 * InputStream in; String reqJson=""; try { in =
		 * request.getInputStream(); reqJson = IOUtils.toString(in, "utf-8");
		 * log.info("taskSynReq:"+reqJson); } catch (IOException e) {
		 * e.printStackTrace(); log.error(e.toString()); } Map<String, Object>
		 * map = smsInterfaceService.taskSyn(reqJson);
		 * log.info("【短信任务同步接口】返回数据：{}", map); return map;
		 */
	}

	/**
	 * desc:审核结果同步接口
	 * 
	 * @author syl
	 * @Date 2019年9月26日 下午3:01:06
	 * @param checkResultSynReq
	 * @return
	 */
	@RequestMapping(value = "/checkResultSyn", method = RequestMethod.POST)
	public Map<String, Object> checkResultSyn(@RequestBody CheckResultSynReq checkResultSynReq) {
		JSONObject json = (JSONObject) JSON.toJSON(checkResultSynReq);
		HashMap<String, Object> map = smsInterfaceService.checkResultSyn(json);
		log.info("【审核结果同步接口】入参：{}", json);
		log.info("【审核结果同步接口】返回数据：{}", map);
		return map;
	}
}
